import { CallSprite } from "./CallSprite";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { GButton } from "../../../../../com/mui/controls/GButton";
import { FilterConst } from "../../../../component/gconst/FilterConst";
type int = number;
//class SelectTypePanel
    
    export  class SelectTypePanel extends CallSprite
    {
        constructor(arg1: Array<any>)
        {
            super();
            this._aryBtn = [];
            this._dataArray = arg1;
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            var loc1=ResouceConst.getScaleBitmap("ToolTipBg");
            loc1.width = 55;
            loc1.height = this._dataArray.length * 23 + 10;
            this.addChild(loc1);
            var loc2=0;
            while (loc2 < this._dataArray.length) 
            {
                this.createButton(loc2, this._dataArray[loc2]);
                ++loc2;
            }
            return;
        }

        /* internal  */createButton(arg1: int, arg2: Object): void
        {
            var loc1=new GButton();
            loc1.x = 6;
            loc1.y = arg1 * 23 + 5;
            loc1.width = 43;
            loc1.height = 22;
            loc1.styleName = "ButtonMini";
            loc1.name = arg2["name"];
            loc1.label = arg2["label"];
            loc1.textField.filters = [FilterConst.glowFilter];
            loc1.addEventListener(flash.events.MouseEvent.CLICK, this.btnClickHandler);
            this.addChild(loc1);
            this._aryBtn.push(loc1);
            return;
        }

        /* internal  */btnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            callAll((arg1.target as GButton).name);
            return;
        }

        public updateData(arg1: Array<any>): void
        {
            this._dataArray = arg1;
            var loc1=0;
            while (loc1 < this._dataArray.length) 
            {
                (this._aryBtn[loc1] as GButton).label = this._dataArray[loc1]["label"];
                ++loc1;
            }
            return;
        }

        /* internal */ /* var */_dataArray: Array<any>;

        /* internal */ /* var */_aryBtn: Array<any>;
    }
